package com.lzhsite.technology.designPattern.strategy.GuessDemo;
/**
 * 猜拳问题
 * @author lzhcode
 *
 */
public class ClientForGuessDemo {
	
	public static void main(String[] args) {
		
		int seed1 = Integer.parseInt("10");
		int seed2 = Integer.parseInt("20");
		Player player1 = new Player("OnePlayer", new FirstType(seed1));
		Player player2 = new Player("TwoPlayer", new SecondType(seed2));
		for (int i = 0; i < 1000; i++) {
			Hand nextHand1 = player1.nextHand();
			Hand nextHand2 = player2.nextHand();

			if (nextHand1.isWin(nextHand2)) {
				System.out.println("Winner " + player1);
				player1.win();
				player2.lose();
			} else if (nextHand1.isLose(nextHand2)) {
				System.out.println("Winner " + player2);
				player1.lose();
				player2.win();
			} else {
				System.out.println("Draw...");
				player1.draw();
				player2.draw();
			}
		}

		System.out.println("Total Result: ");
		System.out.println("" + player1);
		System.out.println("" + player2);
	}
}
